﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using KorleBu.Application_Classes;

namespace KorleBu
{
    public class Global : System.Web.HttpApplication
    {
        #region Class State Variables

        //Create a global user object that can be accessed throughout the web application and the user's session.
        //public static User loggedInUser = new User();
        public User loggedInUser;

        #endregion

        public Global()
        {
            loggedInUser = new User();
        }

        #region Methods

        protected void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs
        }

        protected void Session_End(object sender, EventArgs e)
        {
            // Code that runs when a session ends. 
            // Note: The Session_End event is raised only when the session state mode
            // is set to InProc in the Web.config file. If session mode is set to StateServer 
            // or SQLServer, the event is not raised.
        }

        protected void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown
        }

        #endregion

        //internal static void reset()
        //{
        //    loggedInUser = new User();
        //}
    }
}